import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from "vue-router";
const Layout = () => import('./../layout/index.vue')
const Login = () => import('./../view/Login.vue')
const Home = () => import('./../view/Home.vue')
const User = () => import('./../view/User.vue')
const InformationOne = () => import('./../view/InformationOne.vue')
const InformationTwo = () => import('./../view/InformationTwo.vue')
 
// 1. 配置路由
const routes: Array<RouteRecordRaw> = [
  {
    path: "/Login",
    name:"Login",
    component: Login,
    meta:{
      title:'登录'
    },
  },{
    path: "/",
    component: Layout,
    name:"Home",
    redirect:'/Home',
    children: [
      { path: "Home", component: Home,
      meta:{
        title:'首页'
      }, }
   ],
  },{
    path: "/User",   
    component: Layout,
    children: [
      { path: "/User", 
      name:"User",
      component: User,
      meta:{
        title:'用户'
      }, }
   ],
  },{
    path: "/Information",
    component: Layout,
    children: [
        { path: "/Information",
        name:"Information", component: InformationOne,
        meta:{
          title:'门店一'
        }, },
        { path: "InformationTwo", 
        name:"InformationTwo",component: InformationTwo,
        meta:{
          title:'门店二'
        }, },
     ], 
  },
 
];
// 2.返回一个 router 实列，为函数，配置 history 模式
const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
 
// 3.导出路由   去 main.ts 注册 router.ts
export default router